__author__ = 'Apple'
#coding:utf-8
#用于产生通知链接
import sys
sys.path.append('..')
import config
import libs.util.get_dwz as get_dwz

__app_id = config.app_id
__host = config.host_name
__note_callback_uri = config.note_callback_uri
___uri_template = "https://open.weixin.qq.com/connect/oauth2/authorize?" \
                  "appid="+ __app_id +"&redirect_uri=%s&response_type=code" \
                  "&scope=snsapi_base&state=%s#wechat_redirect"


def gen_message_link(id):
    base_uri = __host + __note_callback_uri
    full_url =  ___uri_template %(base_uri, id)
    return get_dwz.get_dwz(full_url)['tinyurl']


if(__name__ == '__main__'):
    id = "dsafsdafsf"
    print gen_message_link(id)